﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace prjYan.Forum
{
    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                name: "AjaxUpload",
                url: "ajax/Upload/UploadImage",
                defaults: new { controller = "Upload", action = "UploadImage" }
            );

            routes.MapRoute(
                name: "AjaxSaveThumb",
                url: "ajax/Upload/SaveThumb",
                defaults: new { controller = "Upload", action = "SaveThumb" }
            );
            routes.MapRoute(
                name: "AjaxCheckAuthorize",
                url: "ajax/Comment/AjaxCheckAuthorize",
                defaults: new { controller = "Comment", action = "AjaxCheckAuthorize" }
            );
            routes.MapRoute(
                name: "AjaxSubmitComment",
                url: "ajax/Comment/AjaxSubmitComment",
                defaults: new { controller = "Comment", action = "AjaxSubmitComment" }
            );
            routes.MapRoute(
                name: "AjaxDeleteComment",
                url: "ajax/Comment/AjaxDeleteComment",
                defaults: new { controller = "Comment", action = "AjaxDeleteComment" }
            );

            routes.MapRoute(
                name: "AjaxSubmitInfoGuest",
                url: "ajax/Account/AjaxSubmitInfoGuest",
                defaults: new { controller = "Account", action = "AjaxSubmitInfoGuest" }
            );

            routes.MapRoute(
                name: "AjaxLoadComment",
                url: "ajax/Comment/AjaxLoadComment",
                defaults: new { controller = "Comment", action = "AjaxLoadComment" }
            );

            routes.MapRoute(
                name: "AjaxLoadSubComment",
                url: "ajax/Comment/AjaxLoadSubComment",
                defaults: new { controller = "Comment", action = "AjaxLoadSubComment" }
            );

            routes.MapRoute(
                name: "AjaxLogin",
                url: "ajax/Account/AjaxLogin",
                defaults: new { controller = "Account", action = "AjaxLogin" }
            );
            

            routes.MapRoute(
                name: "PostDetail",
                url: "{url}-p-{id}",
                defaults: new { controller = "PostFrontEnd", action = "Detail", id = UrlParameter.Optional, url = UrlParameter.Optional }
            );

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );
        }
    }
}